<!DOCTYPE html>
<html   xmlns="http://www.w3c.org/1999/xhtml"
        xmlns:h="http://java.sun.com/jsf/html"
        xmlns:p="http://primefaces.org/ui"
        xmlns:f="http://xmlns.jcp.org/jsf/core">
    <h:head>
        <script type="text/javascript">
            function handleMessage(data) {
                $('.display').text(data);
            }
        </script>
    </h:head>
    <h:body>
        <h:form id="form">
            <h:outputText id="out" value="#{counterBean.count}" />
            <p:commandButton value="Click" actionListener="#{counterBean.increment}" />
        </h:form>
        
        <p:socket channel="/counter">
            <p:ajax event="message" update="form:out" />
        </p:socket>
    </h:body>
</html>
